package com.ruoyi.options.controller;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.options.domain.Option;
import com.ruoyi.options.service.IOptionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 前端下拉框的options Controller
 */
@RestController
@RequestMapping("/options")
public class OptionsController {
	
	@Autowired
	private IOptionsService optionsService;
	
	/**
	 * 获取COMPANY_CODE（作业码头）的options
	 */
	@RequestMapping("/getCompanyCodeOptions")
	public AjaxResult getCompanyCodeOptions() {
		
		List<Option> companyCodeOptions = optionsService.getCompanyCodeOptions();
		return AjaxResult.success(companyCodeOptions);
		
	}
	/**
	 * 获取CFS_CODE（作业点）的options
	 * 因为value不是唯一的，因此需要在remark标记好是属于哪个作业码头的
	 */
	@RequestMapping("/getCfsCodeOptions")
	public AjaxResult getCfsCodeOptions() {
		
		List<Option> cfsCodeOptions = optionsService.getCfsCodeOptions();
		return AjaxResult.success(cfsCodeOptions);
		
	}
	
	/**
	 * 获取cusName（客户名称）的options
	 */
	@RequestMapping("/getCusNameOptions")
	public AjaxResult getCusNameOptions() {
		
		List<Option> cusNameOptions = optionsService.getCusNameOptions();
		return AjaxResult.success(cusNameOptions);
		
	}
	
	/**
	 * 获取SHIP_NAME（船名）的options
	 */
	@RequestMapping("/getShipNameOptions")
	public AjaxResult getShipNameOptions() {
		
		List<Option> shipNameOptions = optionsService.getShipNameOptions();
		return AjaxResult.success(shipNameOptions);
		
	}
	
	/**
	 * 获取VOYAGE（航次）的options
	 */
	@RequestMapping("/getVoyageOptions")
	public AjaxResult getVoyageOptions() {
		
		List<Option> voyageOptions = optionsService.getVoyageOptions();
		return AjaxResult.success(voyageOptions);
		
	}






}
